﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using ThongTin;

namespace DuLieu
{
   public class Lop_DL
    {
       KetNoi_DL ketnoi = new KetNoi_DL();
       public DataTable DanhSachLopHoc()
       {
           return ketnoi.LayDuLieu("DanhSachLopHoc");
       }
       //THÊM LỚP HỌC 
       public int ThemLopHoc(Lop_TT Lop)
       {
           int Nparameter = 5;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaLop"; value[0] = Lop.MaLop;
           name[1] = "@TenLop"; value[1] = Lop.TenLop;
           name[2] = "@MaKhoaHoc"; value[2] = Lop.MaKhoaHoc;
           name[3] = "@MaHeDaoTao"; value[3] = Lop.MaHeDaoTao;
           name[4] = "@MaNganh"; value[4] = Lop.MaNganh;
           return ketnoi.CapNhat("ThemLopHoc", name, value, Nparameter);
       }
       //SỬA THÔNG TIN LỚP 
       public int SuaThongTinLopHoc(Lop_TT Lop)
       {
           int Nparameter = 5;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaLop"; value[0] = Lop.MaLop;
           name[1] = "@TenLop"; value[1] = Lop.TenLop;
           name[2] = "@MaKhoaHoc"; value[2] = Lop.MaKhoaHoc;
           name[3] = "@MaHeDaoTao"; value[3] = Lop.MaHeDaoTao;
           name[4] = "@MaNganh"; value[4] = Lop.MaNganh;
           return ketnoi.CapNhat("SuaThongTinLopHoc", name, value, Nparameter);
       }
       //XÓA LỚP 
       public int XoaLopHoc(Lop_TT Lop)
       {
           int Nparameter = 1;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaLop"; value[0] = Lop.MaLop;
           return ketnoi.CapNhat("XoaLopHoc", name, value, Nparameter);
       }
       //TÌM KIẾM LỚP 
       public DataTable TimKiemLopHoc(Lop_TT Lop)
       {
           int Nparameter = 1;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@TimKiem"; value[0] = Lop.MaLop;
           return ketnoi.TimKiem("TimKiemLopHoc", name, value, Nparameter);
       }
    }
}
